import fetch from 'common/src/utils/fetch';

const pageUrl =
    '/api/electionservice/graduateExamStudentManage/listExamStudent';
/**
 *查询考场下拉
 */
function listRoom(data) {
    return fetch({
        url: '/api/electionservice/graduateExamStudentManage/listRoom',
        method: 'post',
        data: data
    });
}

/**
 *排考学生下拉表
 */
function listStudent(data) {
    return fetch({
        url: '/api/electionservice/graduateExamStudentManage/listStudent',
        method: 'post',
        data: data
    });
}
/**
 *排考课程下拉表
 */
function listCourse(data) {
    return fetch({
        url: '/api/electionservice/graduateExamStudentManage/listCourse',
        method: 'post',
        data: data
    });
}
/**
 *根据条件导出应考学生
 */
function exportStu(data) {
    return fetch({
        url: '/api/electionservice/graduateExamStudentManage/export',
        method: 'post',
        data: data,
        showMask: false
    });
}
/**
 *批量删除应考学生
 */
function deleteExamStudent(data) {
    return fetch({
        url: '/api/electionservice/graduateExamStudentManage/deleteExamStudent',
        method: 'post',
        data: data
    });
}
/**
 * 批量更换应考学生考场
 */
function changeExamStudentRoom(data, examRoomId,examInfoId) {
    return fetch({
        url:
            '/api/electionservice/graduateExamStudentManage/changeExamStudentRoom?examRoomId=' +
            examRoomId + '&examInfoId=' + examInfoId,
        method: 'post',
        data: data
    });
}

/**
 *通过Id查找考场
 */
function getExamRooms(examInfoIds) {
    return fetch({
        url:
            '/api/electionservice/graduateExamStudentManage/getExamRoomByExamInfoId?examInfoIds=' +
            examInfoIds,
        method: 'get'
    });
}

/**
 * 添加应考学生
 */
function addExamStudent(data) {
    return fetch({
        url: '/api/electionservice/graduateExamStudentManage/addExamStudent',
        method: 'post',
        data: data
    });
}

/**
 * 获取key
 */
function exportStatus(key) {
    return fetch({
        url: '/api/electionservice/reportManagement/result/' + key,
        method: 'get'
    });
}

/**
 * 设置考试情况
 */
function setExamInfo(data, examSituation) {
    return fetch({
        url:
            '/api/electionservice/graduateExamStudentManage/setExamStudentSituatiion?examSituation=' +
            examSituation,
        method: 'post',
        data: data
    });
}

/**
 * 根据课程代码获取考场信息
 */
function getExamInfo(data) {
    return fetch({
        url:
            '/api/electionservice/graduateExamStudentManage/getRoomsByCourseCode',
        method: 'post',
        data: data
    });
}

export default {
    listRoom: listRoom,
    listStudent: listStudent,
    listCourse: listCourse,
    exportStu: exportStu,
    deleteExamStudent: deleteExamStudent,
    changeExamStudentRoom: changeExamStudentRoom,
    addExamStudent: addExamStudent,
    getExamRooms: getExamRooms,
    pageUrl: pageUrl,
    exportStatus: exportStatus,
    setExamInfo: setExamInfo,
    getExamInfo: getExamInfo,
};
